package com.fdd.op.sdk.request.api.account;

import com.fdd.op.sdk.ApiRuleException;
import com.fdd.op.sdk.BaseFddRequest;
import com.fdd.op.sdk.constants.Constants;
import com.fdd.op.sdk.internal.mapping.RequestField;
import com.fdd.op.sdk.internal.util.FddHashMap;
import com.fdd.op.sdk.internal.util.StringUtils;
import com.fdd.op.sdk.response.api.account.GetAccountResponse;

import java.util.Map;

/**
 * API: /user/api/account/getAccount request
 *
 * @author Fadada
 * @date 2021/04/26
 */
public class GetAccountRequest extends BaseFddRequest<GetAccountResponse> {
	@Override
	public String getApiMethodName() {
		return "/user/api/account/getAccount";
	}

	@Override
	public String getHttpMethod() {
		return Constants.METHOD_GET;
	}

	@Override
	public Map<String, Object> getTextParams() {
		FddHashMap txtParams = new FddHashMap();
		if(this.udfParams != null) {
			txtParams.putAll(this.udfParams);
		}
		return txtParams;
	}

	@Override
	public Class<GetAccountResponse> getResponseClass() {
		return GetAccountResponse.class;
	}

	@Override
	public void check() throws ApiRuleException {
		if(StringUtils.isBlank(getAccountId()) && StringUtils.isBlank(getAreaCode()) && StringUtils.isBlank(getEmail())
				&& StringUtils.isBlank(getMobile()) && StringUtils.isBlank(getTpAccountId()) && StringUtils.isBlank(getUserName())){
			throw new ApiRuleException("90000", "参数不能为空");
		}
	}

	/** 用户在当前系统的唯一标识 */
	@RequestField("用户在当前系统的唯一标识")
	private String accountId;

	/** 区号 */
	@RequestField("用户在当前系统的唯一标识")
	private String areaCode;

	/** 用户邮箱 */
	@RequestField("用户在当前系统的唯一标识")
	private String email;

	/** 用户手机号 */
	@RequestField("用户在当前系统的唯一标识")
	private String mobile;

	/** 用户在第三方业务系统的唯一标识 */
	@RequestField("用户在当前系统的唯一标识")
	private String tpAccountId;

	/** 用户姓名 */
	@RequestField("用户姓名")
	private String userName;

	public String getAccountId() {
		return accountId;
	}

	public void setAccountId(String accountId) {
		this.accountId = accountId;
	}

	public String getAreaCode() {
		return areaCode;
	}

	public void setAreaCode(String areaCode) {
		this.areaCode = areaCode;
	}

	public String getEmail() {
		return email;
	}

	public void setEmail(String email) {
		this.email = email;
	}

	public String getMobile() {
		return mobile;
	}

	public void setMobile(String mobile) {
		this.mobile = mobile;
	}

	public String getTpAccountId() {
		return tpAccountId;
	}

	public void setTpAccountId(String tpAccountId) {
		this.tpAccountId = tpAccountId;
	}

	public String getUserName() {
		return userName;
	}

	public void setUserName(String userName) {
		this.userName = userName;
	}
}